package io.jee.caisan.weixin.service.security;

import java.util.Collection;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;

public class UserInfo extends User {
	
	private Integer mid;
	
	public UserInfo(String username, String password, Collection<? extends GrantedAuthority> authorities) {
		super(username, password, authorities);
	}

	private static final long serialVersionUID = 1L;
	
	public static UserInfo getUser(){
		return (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	}

	public Integer getMid() {
		return mid;
	}

	public void setMid(Integer mid) {
		this.mid = mid;
	}

}
